package mlz.d_object;

public class DemoTest01 {
    public static void main(String[] args) {
        System.out.println("-----------toString----------");
        Student stu1 = new Student("张三",21);
        System.out.println(stu1);//mlz.d_object.Student@3b07d329
        //System.out.println(stu1.toString());

        System.out.println("-----------equals----------");
        Student stu2 = new Student("lucy", 21);
        Student stu3 = new Student("lucy", 21);
        System.out.println(stu2.equals(stu3));//false true
        System.out.println(stu2 == stu3);//false

        System.out.println("-----------getClass----------");
        Student stu4 = new Student("marry", 12);
        Student stu5 = new Student("tom", 12);
        Class c1 = stu4.getClass();//Student
        Class c2 = stu5.getClass();
        //同种类型的对象,对应的字节码对象是不是同一个
        System.out.println(c1 == c2);//true
        System.out.println(c1);//class mlz.d_object.Student




    }
}
